import httpInstance from '@/utils/http'

export const getMessageById = (uid) => {
  return httpInstance({
    url: `/api/message/getMessageById/${uid}`,
    method: 'get',
  })
}

export const getSessionMessage = (sessionId) => {
  return httpInstance({
    url: `/api/message/getSessionMessage/${sessionId}`,
    method: 'get',
  })
}

export const updateSession = (sessionId, uid) => {
  return httpInstance({
    url: `/api/message/updateSession/${sessionId}?uid=${uid}`, // ✅ 传入当前用户 id
    method: 'put',
  })
}

export const getMessageCount = (uid) => {
  return httpInstance({
    url: `/api/message/getMessageCount/${uid}`,
    method: 'get',
  })
}
export const createSession = (uid, targetId) => {
  return httpInstance({
    url: '/api/message/createSession', // 假设后端接口地址
    method: 'post',
    data: {
      // POST请求使用data传递参数
      senderId: uid,
      receiverId: targetId,
    },
  })
}
